package chapter4.No4_1_使用reentrantLock类.demo14;

/**
 * *：
 *    方法isFair()：判断是否是公平锁
 * Created by Administrator on 2016/11/22.
 */
public class Main {

    public static void main(String[] args) throws InterruptedException {
        final ServiceClass sc = new ServiceClass(true);
        Runnable runnable = new Runnable() {
            public void run() {
                sc.methodA();
            }
        };
        Thread a = new Thread(runnable);
        a.setName("a");
        a.start();

        Thread.sleep(200);

        final ServiceClass sc2 = new ServiceClass(false);
        Runnable runnable2 = new Runnable() {
            public void run() {
                sc2.methodA();
            }
        };
        Thread b = new Thread(runnable2);
        b.setName("b");
        b.start();

    }

}
